package com.woniu.springboot.mp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author zhaolei
 * @date 2021/4/27 - 1:44
 */
@Configuration
public class SawaggerJavaConfig {
    @Bean
    public Docket createRequestApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo()).select()
                .apis(RequestHandlerSelectors.basePackage("com.woniu.springboot.mp"))
                .build();
    }
    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("中心api")
                .description("用户中心的api文件")
                .termsOfServiceUrl("http://localhost:8080")
                .contact(new Contact("zhaolei","http://localhost:8080","1428334132@qq.com"))
                .version("1.0")
                .license("woniu")
                .build();
    }
}
